package com.stedu.service.impl;

import com.stedu.bean.Student;
import com.stedu.bean.Teacher;
import com.stedu.mapper.StudentOperateMapper;
import com.stedu.service.StudentOperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class StudentOperateServiceImpl implements StudentOperateService {
    @Autowired
    private StudentOperateMapper studentOperateMapper;
    @Override
    @Transactional(rollbackFor = Exception.class)//加回滚
    public List<Teacher> selectAllTeacherAndCourse() {
        return studentOperateMapper.selectAllTeacherAndCourse();
    }

    @Override
    public Student selectBySno(String sno) {
        return studentOperateMapper.selectBySno(sno);
    }

    @Override
    public Student selectBySid(Integer sid) {
        return studentOperateMapper.selectBySid(sid);
    }

    @Override
    public List<Student> selectedTeacherAndCourse(String sno) {
        return studentOperateMapper.selectedTeacherAndCourse(sno);
    }

    @Override
    public int studentSid(String sno) {
        return studentOperateMapper.studentSid(sno);
    }

    @Override
    public boolean deleteSidAndTidBySidAndTid(Integer sid, Integer tid) {
         return  studentOperateMapper.deleteSidAndTidBySidAndTid(sid,tid);
    }

    @Override
    public boolean insertSidAndTid(Integer sid, Integer tid) {
        return studentOperateMapper.insertSidAndTid(sid,tid);
    }
}
